package invoicesystem.dao.impl;

import invoicesystem.dao.UserDao;
import invoicesystem.entry.User;
import invoicesystem.util.DBHelper;

import java.util.ArrayList;

public class UserDaoImpl implements UserDao {

    private DBHelper db = new DBHelper();

    @Override
    public ArrayList<User> select(String username, String password) {
        System.out.println("mima"+username+"mima"+password);
        String sql = "select * from user where account=? and password=?";
        return db.selectinfo(sql, User.class,username,password);
    }
    @Override
    public User selectByid(int enterprise_id) {
        String sql="select * from user where enterprise_id=?";
        ArrayList<User> list=db.selectinfo(sql,User.class,enterprise_id);
        return list.get(0);
    }
}
